<?php
/**
 * @Author: liuhongbin
 * @Email: 514660094@qq.com
 * @Date: 2019-02-12 16:15:10
 * @Description:
 * @LastEditors: liuhongbin
 * @LastEditTime: xxx
 */

namespace app\controller\adminapi\platform\work_wechat;

use app\controller\adminapi\platform\PlatformController;
use hiduoke\services\WorkWechatService;
use think\App;

class KfServicer extends PlatformController
{
    public function __construct(App $app)
    {
        parent::__construct($app);
    }

    /**
     * 显示资源列表
     * @Route("WechatUser", method="GET")
     * @return \think\Response
     */
    public function index()
    {
        try {
            $res = (new WorkWechatService())->getWorkApp()->kf_account->list();
            if ($res['errcode'] == 0) {
                return $this->success('', $res['account_list']);
            } else {
                return $this->error('请检查配置', $res);
            }
        } catch (\Exception $e) {
            return $this->error($e->getMessage());
        }
    }
}
